//导入axios
import axios from 'axios'
//创建axios实例
const request = axios.create({
  baseURL: 'https://restapi.amap.com/v3',
  timeout: 5000,
})

//请求拦截器
request.interceptors.request.use(
  (config) => {
    return config
  },
  (error) => {
    return Promise.reject(error)
  }
)

//响应拦截器,对响应数据进行预处理
request.interceptors.response.use(
  (response) => {
    return response.data
  },
  (error) => {
    return Promise.reject(error)
  }
)

export default request